package com.sencorsta.ids.demo;

import java.util.Random;

public class Robot {
    public static void main(String[] args) {

        for (int i = 0; i < 100; i++) {
            System.out.println(isMustWin(10000,0));
        }
    }

    //lineWater水线 poorW水池
    public static boolean isMustWin(int lineWater,int poorW){
        double lineW = lineWater;
        Random random = new Random();
        double temp=Math.abs(poorW - lineW) / lineW;
        System.out.println(temp);
        if (poorW > lineW) {//吐钱
            if (random.nextDouble() < temp) {
                //机器人必输
                return false;
            } else {
                if (random.nextInt(100) < 50) {
                    //机器人必输
                    return false;
                } else {
                    //机器人必赢
                    return true;
                }
            }
        } else {//收钱
            if (random.nextDouble() < temp) {
                //机器人必赢
                return true;
            } else {
                if (random.nextInt(100) < 50) {
                    //机器人必输
                    return false;
                } else {
                    //机器人必赢
                    return true;
                }
            }
        }
    }
}
	
